package com.maoyu.cloud.api.Controller;

import com.maoyu.cloud.api.common.Response;
import com.maoyu.cloud.api.entity.LoginEntity;
import com.maoyu.cloud.api.service.ApiService;
import com.maoyu.cloud.login.entity.LoginUserEntity;
import com.maoyu.cloud.mybatis.entity.PtUserEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api")
public class ApiController {
    @Resource
    private ApiService apiService;

    /**
     * 登陆接口
     */
    @RequestMapping("/login")
    public Response login(@RequestBody LoginEntity loginEntity) {
        PtUserEntity user = apiService.login(loginEntity);
        if (user == null) {
            return new Response("用户名或密码错误");
        }
        return new Response(user);
    }
}
